import request from '@/utils/request'
import { data } from 'autoprefixer'

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/login',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/getInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}
// 预约车辆
export function getreservationCount() {
  return request({
    url: '/system/reservation/reservationCount',
    method: 'get'
  })
}
// 待审单车辆
export function getSelectReservationList(data) {
  return request({
    url: '/system/reservation/selectReservationList',
    method: 'post',
    data: data,
  })
}
// 大屏预约
export function getSelectReservationDp(data) {
  return request({
    url: '/system/reservation/selectReservationDp',
    method: 'post',
    data: data,
  })
}
export function getSelectReservationArray(data) {
  return request({
    url: '/system/reservation/selectReservationArray',
    method: 'post',
    data: data,
  })
}
// 获取二维码
export function coachQRCodelist() {
  let min = 1;  // 最小值
  let max = 10000; // 最大值
  let data = Math.floor(Math.random() * (max - min + 1)) + min;
  return request({
    url: '/system/reservation/coachQRCode?id=' + data,
    method: 'get',
    responseType: 'blob'
  })
}
